import { ElNotification } from 'element-plus'
import { h } from 'vue'
export default function WebNotification(options: any) {
  return ElNotification(options)
}
interface NotificationParams {
  title?: string
  message?: string
  duration?: number
}
WebNotification.error = (params: NotificationParams = {}) => {
  const defaultOption = { title: '错误提示', message: '操作失败', duration: 2000, customClass: 'web-notification' }
  const mergeOption = { ...defaultOption, ...params }
  ElNotification({
    ...mergeOption,
    icon: h('img', {
      src: ''
    })
  })
}
WebNotification.success = (params: NotificationParams = {}) => {
  const defaultOption = { title: '成功提示', message: '操作成功', duration: 2000, customClass: 'web-notification' }
  const mergeOption = { ...defaultOption, ...params }
  ElNotification({
    ...mergeOption,
    icon: h('img', {
      src: ''
    })
  })
}
WebNotification.warning = (params: NotificationParams = {}) => {
  const defaultOption = { title: '操作提醒', message: '请传入操作', duration: 2000, customClass: 'web-notification' }
  const mergeOption = { ...defaultOption, ...params }
  ElNotification({
    ...mergeOption,
    icon: h('img', {
      src: ''
    })
  })
}
WebNotification.info = (params: NotificationParams = {}) => {
  const defaultOption = { title: '消息提示', message: '请传入提示', duration: 2000 }
  const mergeOption = { ...defaultOption, ...params }
  ElNotification({
    ...mergeOption,
    icon: h('img', {
      src: ''
    })
  })
}
